#include <windows.h>
#include <tchar.h>

void _tmain(int argc, TCHAR* argv[])
{
	_tprintf(_T("Waiting for termination event\n"));
	
	HANDLE hEvent;

	hEvent = OpenEvent(EVENT_ALL_ACCESS, FALSE, _T("StopInjectee"));
	
	if (hEvent != NULL)
	{
		DWORD ret = WaitForSingleObject(hEvent, INFINITE);
		
		if (ret != WAIT_OBJECT_0)
		{
		    _tprintf(_T("wait failed with error %u"), GetLastError());
		}
		else
		{
		    _tprintf(_T("termination event received\n"));
		}
	}
	else
	{
		_tprintf(_T("unable to open event"));
	}
}
